#!/bin/sh /etc/rc.common

USE_PROCD=1
START=92

start_instance() {
	local cfg="$1"
	local aux

	config_get_bool aux "$cfg" 'disabled' '0'
	[ "$aux" = 1 ] && return 1

	procd_open_instance

	procd_set_param command /usr/bin/vdr
	procd_set_param file /etc/vdr/00-vdr.conf

	config_get_bool aux "$cfg" 'respawn' '0'
	[ "$aux" = 1 ] && procd_set_param respawn

	procd_close_instance
}

service_triggers() {
	procd_add_reload_trigger "vdr"
}

start_service() {
	config_load vdr
	config_foreach start_instance vdr
}
